﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Sharp.Portal.Mvc.Form;

namespace Sharp.Portal.Mvc
{
    public static class SharpFormExtensions
    {
        /// <summary>
        /// 隐藏字段的扩展方法
        /// </summary>
        /// <param name="formSections"></param>
        /// <param name="names"></param>
        public static void Hide(this IList<FormSection> formSections, params string[] names)
        {
            foreach (var item in formSections)
            {
                foreach (var f in item.Fields)
                {
                    if (names.Any(n => n == f.Name))
                    {
                        f.HideField = true;
                    }
                }
            }
        }

    }
}
